package com.apollo.java;

import com.apollo.java.config.TestConfig;
import com.google.common.base.Charsets;

import java.io.BufferedReader;
import java.io.InputStreamReader;

/**
 * @author: LiuWei
 * @date: Create in 14:48 2018/08/07
 */
public class JavaDemo {
    public static void main(String[] args) throws Exception {
        //这里设置config-server地址
        System.setProperty("dev_meta", "http://192.168.10.51:9000");
        System.setProperty("env", "DEV");

        TestConfig testConfig = new TestConfig();
        System.out.println(
                "Apollo Config Demo. Please input key to get the value. Input quit to exit.");
        while (true) {
            System.out.print("> ");
            String input = new BufferedReader(new InputStreamReader(System.in, Charsets.UTF_8)).readLine();
            if (input == null || input.length() == 0) {
                continue;
            }
            input = input.trim();
            if (input.equalsIgnoreCase("quit")) {
                System.exit(0);
            }
            testConfig.getConfig(input);
        }
    }
}
